{include file="header/index" /}
		<div class="container whitebg mb50">
			<div class="topnav clearfix">
				<div class="title fl">
					<h3>客户详情</h3>
					<a href="#information" class="ac">基本信息</a>
					<a href="#operation">合同信息</a>
					<a href="#operation_record">操作记录</a>
				</div>
				<div class="backbtnwrap fr">
					<button type="button" class="btn backbtn" onclick="backurl(this)">返回</button>
				</div>
			</div>
			
			<!--基本信息-->
			<div class="information" id="information">
				<p class="title">基本信息</p>
				<table class="table table-bordered order_details_table">
					<tr>
						<th>姓名</th>
						<td>{$info.username}</td>
						<th>账户</th>
						<td>{$info.telphone}</td>
					</tr>
					<tr>
						<th>创建时间</th>
						<td>{$info.add_time}</td>
						<th>账号状态</th>
						<td class="redcolor">{$info.account_status}</td>
					</tr>
					<tr>
						<th>生日</th>
						<td>{$info.birthday}</td>
						<th>所属管理区域</th>
						<td>{$info.ocompany_name}-{$info.acompany_name}</td>
					</tr>
					<tr>
						<th>客户性质</th>
						{if condition="$info.nature == '商用客户'"}
							<td>{$info.nature}-{$info.username}</td>
						{else /}
							<td>{$info.nature}</td>
						{/if}
						<th>住屋性质</th>
						<td>{$info.housing_property}</td>
					</tr>
					<tr>
						<th>是否入职</th>
						{if condition="$info.is_entry == '入职'"}
							<td>{$info.is_entry}&nbsp;&nbsp;&nbsp;员工编号{$info.employee_id}</td>
						{else /}
							<td>{$info.is_entry}</td>
						{/if}
						<th>推荐设备数</th>
						<td>{$info.number}台&nbsp;&nbsp;</td>
					</tr>
					<tr>
						<th>联系地址</th>
						<td colspan="3">{$info.user_address}&nbsp;&nbsp;&nbsp;<i class="glyphicon glyphicon-map-marker"></i></td>
					</tr>
					<tr>
						<th>备注</th>
						<td colspan="3">{$info.remark}</td>
					</tr>
				</table>
			</div>
			
			<!--合同信息-->
			<div class="operation" id="operation">
				<p class="title">合同信息</p>
				<div class="contract_information contract_hide clearfix">
					{volist name="Contract" id="co"}
					<div class="contract_information_item">
						<div class="contract_inner">
							<a href="{:url('Contractinfo/details')}?contract_id={$co.contract_id}">
								<h4>合同{$co.No}</h4>
								<span class="mb15">CONTRACT</span>
								<p>合同编号:<span class="date">{$co.contract_no}</span></p>
								<p>设&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;备:<span>{$co.EquipmentNumber}台</span></p>
								<p>签约日期:<span>{$co.installed_time}</span></p>
							</a>
						</div>
					</div>
					{/volist}
				</div>
				<p class="title fr pointer" onclick="morecontract()">更多&nbsp;&nbsp;<i class="glyphicon glyphicon-chevron-down"></i></p>
			</div>
			<div class="clearfix"></div>
			
			<!--操作记录-->
			<div class="operation_record" id="operation_record">
				<p class="title">操作记录</p>
				<div class="record_list">
				{if condition="(isset($log))"}
					{volist name="log" id="n" key="k"}
						<p>用户{$info.username}的{$n.filename}信息由{$n.operator_name}{$n.operator_account}修改，修改前为{$n.old_content}，修改后为{$n.new_content}。<time class="fr">{$n.add_time}</time></p>	
					{/volist}
				{else /}
					<p>暂无操作记录</p>
				{/if}	
				</div>
				<input type="hidden" name="page" id="page" value="1"/>
				<p class="title fr pointer" onclick="loadLog({$info.user_id})">更多&nbsp;&nbsp;<i class="glyphicon glyphicon-chevron-down"></i></p>
			</div>
		</div>		
		
	</body>

</html>
<script type="text/javascript">
	//顶部导航
	$('.topnav a').click(function() {
		$(this).addClass('ac').siblings('a').removeClass();
	});

	//返回上一页
	function backurl() {
		history.back();
	}

	//隐藏合同
	function morecontract() {
		if($('.contract_information').hasClass('contract_hide')) {
			$('.contract_information').removeClass('contract_hide');
			$('.operation .title i').removeClass().addClass('glyphicon glyphicon-chevron-up');

		} else {
			$('.contract_information').addClass('contract_hide');
			$('.operation .title i').removeClass().addClass('glyphicon glyphicon-chevron-down');
		}
	}

	//加载更多数
	function loadLog(uid){
	    var page = $('#page').val();
        $.ajax({
            type:'post',
			datatype:'json',
            url:"{:url('Customerinfo/getUserLog')}",
			data:{page:page,uid:uid},
            success:function(data){
				console.info(data);
				if(data.code==1){
                    for(var val in data.data){
                        console.info(data.data[val]);
                        $('#page').val(data.page);
                        var info = '<p>用户' + data.data[val]['username'] + '的' + data.data[val]['filename'] + '信息由' + data.data[val]['operator_name'] + data.data[val]['operator_account'] + '修改，修改前为' + data.data[val]['old_content'] + '，修改后为' + data.data[val]['new_content'] + '。<time class="fr">' + data.data[val]['add_time'] + '</time></p>';
                        $(".record_list").append(info);
                    }
                }
            },
            error:function(){
                //请求出错处理
            }
        });
    }
	
	
	
</script>